from rest_framework.throttling import SimpleRateThrottle


class CommonThrottle(SimpleRateThrottle):
    rate = '30/s'

    def get_cache_key(self, request, view):
        # 以ip地址作为频率限制的准则
        return request.META.get("REMOTE_ADDR")
